﻿// JScript 文件
// <!CDATA[
var xmlHttp;
var P_list;
//创建对象
function createXMLHttpRequest()
{

    var isRight = true;
    try{ xmlHttp = new XMLHttpRequest(); }
    catch(trymicrosoft)
    {
        try{xmlHttp = new ActiveXobject("Msxml2.XMLHTTP");}
        catch(othermicrosoft)
        {
            try{xmlHttp = new ActiveXobject("Microsoft.XMLHTTP");}
            catch(failed)
            {
                isRight = false;
            }
        }
    }
    if(!isRight)
      alert("XML对象创建失败");
}
//获取数据
function GetData()
{      
    P_list=document.getElementById("P_List");    
    P_list.innerHTML = "<span >Loading  <img src='images/ajax-loader.gif'></span>";
    var Url = "DefaultHandler.ashx";    
    createXMLHttpRequest();
    xmlHttp.onreadystatechange = CallBack;
    xmlHttp.open("GET", Url, true);
    xmlHttp.send(null);
}
//此方法直接从服务器端返回HTML
function CallBack()
{
    if (xmlHttp.readyState == 4){
        if (xmlHttp.status == 200)
        {
            P_list.innerHTML = xmlHttp.responseText;           
        }else
        {
            P_list.innerHTML = "数据获取错误！"+xmlHttp.status;
        }
    }
}
// ]]>
